//
//  ShenPiXiangQingShenPiNeiRongTableViewCell.m
//  JuBoCRM
//
//  Created by iMac on 2024/4/2.
//  Copyright © 2024 iningKe. All rights reserved.
//

#import "ShenPiXiangQingShenPiNeiRongTableViewCell.h"

@implementation ShenPiXiangQingShenPiNeiRongTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(AllModel *)model{
    _model = model;
    
    NSDictionary *dataDic = model.modelInfoDictionary;
    
    _nameLabel.text = GetHandleString(dataDic, @"name");
    _valueLabel.text = GetHandleString(dataDic, @"value");
    
    
    NSDictionary *attrs = @{NSFontAttributeName : [UIFont boldSystemFontOfSize:15]};
    CGSize size=[_nameLabel.text sizeWithAttributes:attrs];
    
    _nameLabel.sd_layout
    .leftSpaceToView(self.contentView, 16)
    .topSpaceToView(self.contentView, 8)
    .widthIs(size.width+8)
    .heightIs(18);
    
    _valueLabel.sd_layout
    .leftSpaceToView(_nameLabel, 8)
    .topSpaceToView(self.contentView, 13)
    .rightSpaceToView(self.contentView, 16)
    .autoHeightRatio(0);
    
    if([GetHandleString(dataDic, @"value") length] > 0){
        [self setupAutoHeightWithBottomView:_valueLabel bottomMargin:8];
    }else{
        [self setupAutoHeightWithBottomView:_nameLabel bottomMargin:8];
    }
    
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end

